<!--
 * @Author: daidai
 * @Date: 2022-01-12 14:23:32
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-09-09 14:47:24
 * @FilePath: \web-pc\src\pages\big-screen\view\home.vue
-->
<template>
<div style="background-color: #000;">
<ScaleScreen
    :width="1920"
    :height="1080"
    class="scale-wrap"
    :selfAdaption="true"
  >
  <!-- <div class="scale-wrap"> -->
    <div class="bg">
      <dv-loading v-if="loading">Loading...</dv-loading>
      <div v-else class="host-body">
        <div class="bupt-icon"><img src="../assets/img/bupt.png"></div>
        <!-- 头部 s -->
        <div class="d-flex jc-center title_wrap">
          <div class="zuojuxing"></div>
          <div class="youjuxing"></div>
          <div class="guang"></div>
          <div class="d-flex jc-center">、
            <div class="title">
			        <!-- <span class="title-text">数据高效管理机制与传输方法测试服务平台</span> -->
              <!-- <span class="title-text">面向6G智能化的数据高效管理与传输系统</span> -->
              <span class="title-text">网络智能化数据高效管理平台</span>
            </div>
          </div>
          <div class="time">
            <p>{{ currentTime }}</p>
          </div>
        </div>
        
        <!-- 头部 e-->
        <!-- 内容  s-->
        <router-view />
        <!-- 内容 e -->
      </div>
    </div>
    <!-- <Setting ref="setting" /> -->
  <!-- </div> -->
  </ScaleScreen>
  </div>
</template>

<script>
// import { formatTime } from "../utils/index.js";
// import Setting from "./setting.vue";
import ScaleScreen from "@/components/scale-screen/scale-screen.vue";
export default {
  components: {ScaleScreen },
  data() {
    return {
      timing: null,
      loading: true,
      currentDate: '',
      currentTime: ''
    };
  },
  filters: {
    numsFilter(msg) {
      return msg || 0;
    },
  },
  computed: {},
  created() {},
  mounted() {
    this.cancelLoading();
    // 更新日期和时间
    this.updateDateTime();
    // 每秒更新一次时间
    setInterval(() => {
      this.updateDateTime();
    }, 1000);
  },
  beforeDestroy() {
    clearInterval(this.timing);
    // 在组件销毁前清除定时器
    clearInterval(this.timer);
  },
  methods: {
    goLogMonitor(){
      this.$router.push('/KeepRecord')
    },
    cancelLoading() {
      let timer = setTimeout(() => {
        this.loading = false;
        clearTimeout(timer);
      }, 500);
    },
    updateDateTime() {
      const now = new Date();
      const year = now.getFullYear();
      const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份从0开始，需要加1并且补零
      const day = String(now.getDate()).padStart(2, '0'); // 日期需要补零
      const hours = String(now.getHours()).padStart(2, '0');
      const minutes = String(now.getMinutes()).padStart(2, '0');
      const seconds = String(now.getSeconds()).padStart(2, '0');
      this.currentDate = `${year}/${month}/${day}`;
      this.currentTime = `${hours}:${minutes}:${seconds}`;
    }
  },
};
</script>

<style lang="scss">
@import "./home.scss";
.time p {
  font-size: 40px; /* 设置字体大小 */
  font-family: "Digital-7", sans-serif;
  color: #A1887F;
}
</style>
